Optimal. Leaf size=75 \[ \frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+2 a^2 x (B+i A)+\frac {a^2 A \log (\sin (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.16, antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3594, 3589, 3475, 3531} \[ \frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+2 a^2 x (B+i A)+\frac {a^2 A \log (\sin (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3531
Rule 3589
Rule 3594
Rubi steps
\begin {align*} \int \cot (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\int \cot (c+d x) (a+i a \tan (c+d x)) (a A+a (i A+2 B) \tan (c+d x)) \, dx\\ &=\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}-\left (a^2 (A-2 i B)\right ) \int \tan (c+d x) \, dx+\int \cot (c+d x) \left (a^2 A+2 a^2 (i A+B) \tan (c+d x)\right ) \, dx\\ &=2 a^2 (i A+B) x+\frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\left (a^2 A\right ) \int \cot (c+d x) \, dx\\ &=2 a^2 (i A+B) x+\frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+\frac {a^2 A \log (\sin (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 3.16, size = 201, normalized size = 2.68 \[ \frac {a^2 (\cos (2 d x)+i \sin (2 d x)) (A+B \tan (c+d x)) \left (\sec (c) \left (\cos (d x) \left ((A-2 i B) \log \left (\cos ^2(c+d x)\right )+8 d x (B+i A)+A \log \left (\sin ^2(c+d x)\right )\right )+\cos (2 c+d x) \left ((A-2 i B) \log \left (\cos ^2(c+d x)\right )+8 d x (B+i A)+A \log \left (\sin ^2(c+d x)\right )\right )-4 B \sin (d x)\right )-8 i (A-i B) \cos (c+d x) \tan ^{-1}(\tan (3 c+d x))\right )}{4 d (\cos (d x)+i \sin (d x))^2 (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.72, size = 97, normalized size = 1.29 \[ \frac {-2 i \, B a^{2} + {\left ({\left (A - 2 i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (A - 2 i \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + {\left (A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + A a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.88, size = 175, normalized size = 2.33 \[ \frac {A a^{2} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) + {\left (A a^{2} - 2 i \, B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) - 2 \, {\left (2 \, A a^{2} - 2 i \, B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) + {\left (A a^{2} - 2 i \, B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - \frac {A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 2 i \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - A a^{2} + 2 i \, B a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.44, size = 100, normalized size = 1.33 \[ 2 i A \,a^{2} x +\frac {2 i A \,a^{2} c}{d}-\frac {2 i B \,a^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}+2 a^{2} B x +\frac {a^{2} A \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {a^{2} A \ln \left (\sin \left (d x +c \right )\right )}{d}-\frac {a^{2} B \tan \left (d x +c \right )}{d}+\frac {2 B \,a^{2} c}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.73, size = 66, normalized size = 0.88 \[ \frac {{\left (d x + c\right )} {\left (2 i \, A + 2 \, B\right )} a^{2} - {\left (A - i \, B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + A a^{2} \log \left (\tan \left (d x + c\right )\right ) - B a^{2} \tan \left (d x + c\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.20, size = 70, normalized size = 0.93 \[ \frac {A\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {2\,A\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{d}-\frac {B\,a^2\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {B\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,2{}\mathrm {i}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotInvertible} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________